<?php

namespace controllers\admin;

use controllers\AdminApi;
use models\SysUsers;
use system\Factory;

class Auth extends AdminApi {
	/**
	 * 登录
	 * @param string $username
	 * @param string $password
	 * @param string $vercode
	 * @return string
	 * @author Colin <amcolin@126.com>
	 * @date 2021-12-20 下午4:16
	 */
    public function login($username = '', $password = '', $vercode = '') {
        $model = new SysUsers();
        $code  = Factory::CreateCode();
//        if (!$code->verify($vercode)) {
//            return error('验证码不正确');
//        }

        return $model->login($username, $password);
    }

	/**
	 * 注册
	 * @param $username
	 * @param $password
	 * @param string $nickname
	 * @return string
	 * @author Colin <amcolin@126.com>
	 * @date 2021-12-20 下午4:16
	 */
    public function register($username, $password, $nickname = '') {
        $model = new SysUsers();

        return $model->register($username, $password, $nickname);
    }
}
